/**
 * shuang
 */

import React,{Component}from 'react';
import{Platform,
  View,
  Text,
  ScrollView,
  Image,
  Dimensions,
  StyleSheet,
  AppRegistry, TouchableOpacity,
  SectionList,
    FlatList
} from 'react-native';
import CommonStyle from '../../Component/CommonStyle'
import BasePage from '../../Component/Common/BasePage' 
const screenWidth = Dimensions.get('window').width
// export default class HomeTagListCell extends Component{
    export class HomeTagListCell extends BasePage {
  constructor(props){
    super(props)
    const {item}=this.props
  }
    _onPress=()=>{
        this.props.onPress();
    }

    _renderItem = ({item,index}) =>(
        <TouchableOpacity onPress={()=>{
            this.props.OnImagePress(index);
        }}>
            <Image source = {{uri:item.imgUrl}}  style = {{width:85,height:85,marginLeft:1}} />
        </TouchableOpacity>
    );
    _keyExtractor = (item, index) => item;
     render() {
        const {item}=this.props
       return (
          <TouchableOpacity onPress={this._onPress} activeOpacity={1} focusedOpacity={1} style={{marginTop:10, width:'100%', backgroundColor:'#fff',}}>
                 <View style={{width:screenWidth,backgroundColor:'#2452a'}} >
                    <Text style={styles.tagTitle_Text} numberOfLines={2} >{item.title}</Text>
                </View>
                
           {this.props.item.forumImgs.length? <View style={{height:85}}>
                 <FlatList
                        style={styles.flatlist}

                        data={this.props.item.forumImgs}
                        renderItem={this._renderItem}
                        keyExtractor={this._keyExtractor}
                        horizontal={true}
                    /></View>:null}
                {/*<View style={{height:20,width:screenWidth,margintop:10,marginBottom:10,left:30}} flexDirection = 'row' >*/}
                        <View style={{left:15,marginTop:10,width:screenWidth-30,marginBottom:10,flexDirection:'row',backgroundColor:'#fff'}}>
                        <View style={{}} flexDirection= 'row' textAlign='left'>
                          <Image source = {require('./picImages/my_post_yuedu.png')} style = {{ width: scaleSizeToFit(15), height: scaleSizeToFit(15) ,top:0}} />
                          <Text style={{left:3,top:0,fontSize:scaleSizeToFit(14),color:CommonStyle.color_black}}>
                              {item.view}
                              </Text>
                        </View>
                        <View style={{marginLeft:10}} flexDirection= 'row' >
                            <Image source = {require('./picImages/my_post_pinglun.png')} style = {{ width: scaleSizeToFit(15), height: scaleSizeToFit(15) ,top:0}} />
                            <Text style={{left:3,top:0,fontSize:scaleSizeToFit(14),color:CommonStyle.color_black}}>{item.comments}</Text>
                        </View>
                        <View style={{marginLeft:10}} flexDirection= 'row' >
                            <Image source = {require('./picImages/my_shijian.png')} style = {{ width: scaleSizeToFit(15), height: scaleSizeToFit(15) ,top:0}} />
                            <Text style={{left:3,top:0,fontSize:scaleSizeToFit(14),color:CommonStyle.color_black}}>{item.createTime}</Text>
                        </View>
                    </View>
                {/*</View>*/}
            </TouchableOpacity>
    );
  }
}
export default HomeTagListCell
const styles = StyleSheet.create({
   
    tagTitle_Text:{
        fontSize:16,
        color:CommonStyle.color_black,
        left:15,marginTop:15,
        color:'#3C4959',
        width:screenWidth-30,
        lineHeight:20,
    },
  container: {
    flexDirection: 'row',
     height:60,
     backgroundColor:'#fff',
  },
  oneView: {
    left:10,
    top:10,
  },
  twoView: {
   left:20,
   top:10,
    width:screenWidth - 70,
    height:40,
  },
  threeView: {
    width:screenWidth/2,
    left:screenWidth/2
  },
  fourView: {
    left:3,
    fontSize: 10,
  },container1: {
   backgroundColor:'#fff',
height:70,

  },
  topImgWid:{
    top:10,
    left:10,
    borderRadius:25,//圆角处理
    width: 50,
     height: 50 ,
  },

  textWid:{
      
    top:10,
    left:20,
    height:25,
      fontSize:14,
      color:CommonStyle.color_black

  },
    flatlist:{
        marginLeft:15,
        marginRight:15,
        marginBottom:10,
        marginTop:10
    },
});

const scaleSizeToFit = (s) => {
   return s * Dimensions.get('window').width / 414;
 }